/*
*编写必要的代码将一个数组赋给另一个数组
*然后然后把这段代码改用vector实现，考虑如何把一个vector赋给另一个vector
*/
#include <iostream>
#include <vector>
using namespace std;

int main()
{
	//将一个数组赋给另一个数组
	cout << "将一个数组赋给另一个数组：" << endl;
	const int iArySize = 5;
	int iAry1[iArySize] = {6,8,12,56,99};
	int iAry2[iArySize];

	//将iAry1赋给iAry2
	for(int i = 0;i < iArySize;i++)
	{
		iAry2[i] = iAry1[i];
	}

	//输出iAry1
	for(int i = 0;i < iArySize;i++)
	{
		cout << "iAry1[" << i << "] = " << iAry1[i] << "  ";
	}

	cout << endl;

	//输出iAry2
	for(int i = 0;i < iArySize;i++)
	{
		cout << "iAry2[" << i << "] = " << iAry2[i] << "  ";
	}

	cout << endl;

	//将一个vector赋给另一个vector
	cout << "将一个vector赋给另一个vector：" << endl;
	vector<int> ivec1(5,9);
	vector<int> ivec2(5);

	//将ivec1赋给ivec2
	ivec2 = ivec1;

	//输出ivec1
	for (int i = 0 ; i != ivec1.size();i++)
	{
		cout << "iVec1[" << i << "]=" << ivec1[i] << "  ";
	}

	cout << endl;

	//输出ivec2
	for (int i = 0 ; i != ivec2.size();i++)
	{
		cout << "iVec2[" << i << "]=" << ivec2[i] << "  ";
	}

	cout << endl;
	system("pause");
	return 0;
}
